#include<iostream>
#include<unistd.h>
using namespace std;

int b;
int c = 1;
int main(int argc, char* argv[], char* env[])
{
  //int* a = new int[10];
  //cout<<"命令行参数"<<argv<<endl;
  //cout<<"栈区"<<&main<<endl;
  //cout<<"堆区"<<a<<endl;
  //cout<<"未初始化常量"<<&b<<endl;
  //cout<<"已初始化常量"<<&c<<endl;
  //cout<<"字符常量"<<&"嘻嘻哈哈"<<endl;
  pid_t id = fork();
  int cnt = 200;
  if (id == 0)
  {
    while (true)
    {
      cnt = 100;
      cout<<"子进程："<<cnt<<"地址->"<<&cnt<<endl;
      sleep(1);
    }
  }
  else 
  {
    while (true)
    {
      cout<<"父进程："<<cnt<<"地址->"<<&cnt<<endl;
      sleep(1);
    }
  }


  return 0;
}
